package top.javarem.medical.domain.dto;

import com.google.gson.Gson;
import lombok.Data;

import java.util.List;
import java.util.Map;


@Data
public class OrderDTO {

    private List<String> answers;

    private String mbtiType;

    private Map<String, Integer> scores;

    public String answersToString() {
        StringBuffer sb = new StringBuffer();
        for (String answer : this.answers) {
            sb.append(answer);
            sb.append(",");
        }
        return sb.toString();
    }

    public String scoresToString() {
        // 使用 Gson 将 Map 转换为 JSON 字符串
        Gson gson = new Gson();
        return gson.toJson(scores);
    }
}
